
//定义一个接口
// interface myType {
//   address: string
//   run(): string
// }

//定义一个类型限制
type myType = {
  address: string,
  run(): string
}

//接口限制对象
// let obj1:myType = {
//   address: "北京",
//   run() {
//     return "我能跑步"
//   }
// }



//接口限制类
class Student implements myType {
  address: string
  constructor(address: string) {
    this.address = address
  }

  run() {
    return '我能跑步'
  }
}

let s1 = new Student("beijing")
console.log(s1)
